package com.nyist.myticket.web.config;


import com.nyist.myticket.web.interceptor.MyInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * * 拦截器配置类
 *
 * @author yangxiaogen
 * @date 2022/3/2 17:03
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private MyInterceptor myInterceptor;

    
    /**
     * 添加 拦截器注册表
     * @author yangxiaogen 
     * @date 2022/3/3 9:41
     * @param registry
     * @return void
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor)  // 添加自定义拦截器
                .addPathPatterns("/**");    // 添加拦截路径
    }



}
